package eventplanner.rest.exceptionmappers;

import eventplanner.ejb.exceptions.IllegalArgumentFoundException;

import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;

@Provider
public class RestIllegalArgumentFoundExceptionHandler implements ExceptionMapper<IllegalArgumentFoundException> {

	@Override
	public Response toResponse(IllegalArgumentFoundException e) {
		return Response.status(Response.Status.BAD_REQUEST).type(MediaType.TEXT_PLAIN_TYPE).entity(e.getMessage()).build();
	}
}
